import 'package:flutter/material.dart';

class Mylistview extends StatelessWidget {
  Mylistview({super.key});
  final List nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: nums
          .map((e) => Container(
                height: 100,
                color: Colors.primaries[e % Colors.primaries.length], //颜色随机
                child: Text(e.toString()), //将数字转换为字符串s
              ))
          .toList(),
    );
  }
}
